package com.ltw.playit.web.server.entity;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Parameter;


@Entity
public class BaseUsers {
	@Id
	@GeneratedValue(generator = "idGenerator")
	@GenericGenerator(name = "idGenerator", strategy = "com.ltw.playit.web.server.entity.IdGenerator", parameters = {@Parameter(name = "idLength", value = "7")})
	private String userId;
	private String userName;
	private String password;
	private String realName;
	private char sex;
	private String email;
	private String mobile;
	private String officePhone;
	private Short errorCount;
	private Date lastLoginTime;
	private String lastLoginIp;
	private String remark;
	
	@OneToMany(fetch=FetchType.LAZY,cascade={CascadeType.ALL})
	private Collection<BaseRoles> roles = new ArrayList<BaseRoles>();
	
	public String getUserId() {
		return userId;
	}
	public void setUserId(String userId) {
		this.userId = userId;
	}
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	public String getRealName() {
		return realName;
	}
	public void setRealName(String realName) {
		this.realName = realName;
	}
	public char getSex() {
		return sex;
	}
	public void setSex(char sex) {
		this.sex = sex;
	}
	public String getEmail() {
		return email;
	}
	public void setEmail(String email) {
		this.email = email;
	}
	public String getMobile() {
		return mobile;
	}
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	public String getOfficePhone() {
		return officePhone;
	}
	public void setOfficePhone(String officePhone) {
		this.officePhone = officePhone;
	}
	public Short getErrorCount() {
		return errorCount;
	}
	public void setErrorCount(Short errorCount) {
		this.errorCount = errorCount;
	}
	public Date getLastLoginTime() {
		return lastLoginTime;
	}
	public void setLastLoginTime(Date lastLoginTime) {
		this.lastLoginTime = lastLoginTime;
	}
	public String getLastLoginIp() {
		return lastLoginIp;
	}
	public void setLastLoginIp(String lastLoginIp) {
		this.lastLoginIp = lastLoginIp;
	}
	public String getRemark() {
		return remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public Collection<BaseRoles> getRoles() {
		return roles;
	}
	public void setRoles(Collection<BaseRoles> roles) {
		this.roles = roles;
	}
	
}
